//
//  MainViewController.swift
//  WB
//
//  Created by KenLiang on 16/4/5.
//  Copyright © 2016年 KenLiang. All rights reserved.
//

import UIKit

class MainViewController: UITabBarController {
    // MARK:- 懒加载
//    private lazy var composeBtn : UIButton = UIButton()
    private lazy var composeBtn : UIButton = UIButton(imageName: "tabbar_compose_icon_add", bgImageName: "tabbar_compose_button")

    // MARK:- 系统回调方法
    override func viewDidLoad() {
        super.viewDidLoad()
        
        setupComposeBtn()
        
    }
}

// MARK:- 设置UI界面
extension MainViewController {
    private func setupComposeBtn () {
        //添加发布按钮
        tabBar.addSubview(composeBtn)
        
        //设置按钮位置
        composeBtn.center = CGPointMake(tabBar.center.x, tabBar.bounds.size.height * 0.5)
        
        //监听按钮点击
        composeBtn.addTarget(self, action: "composeBtnClick", forControlEvents: .TouchUpInside)
    }
    
    
}


extension MainViewController {
    @objc private func composeBtnClick() {
        print("composeBtnClick")
    }
}
